home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / rand.zip / TYPETEST.PAS < prev   
Pascal/Delphi Source File  |  1992-08-26  |  2KB  |  63 lines

  1. {$S-}{$R-}
  2.  
  3. { TYPETEST.PAS  Created August 27, 1992
  4.   By Ray Sun
  5.  
  6.      This program accompanies RAND.TPU and RAND.PAS as a demonstration
  7. program for the use of the good random numbers.  It chooses a random
  8. number between 1 and 20 and prompts for the user to type that character.
  9. This particular program, as currently set up, helps to improve the
  10. typing of the number keys and symbols above them.
  11.  
  12. }
  13.  
  14. Uses crt, rand;
  15.  
  16. const questions = 20;
  17.  
  18. Var loop, num : integer;
  19.     letter : array [1..questions] of char;
  20.     answer : char;
  21.  
  22. BEGIN
  23.  
  24.      letter[1]:='!';
  25.      letter[2]:='@';
  26.      letter[3]:='#';
  27.      letter[4]:='$';
  28.      letter[5]:='%';
  29.      letter[6]:='^';
  30.      letter[7]:='&';
  31.      letter[8]:='*';
  32.      letter[9]:='(';
  33.      letter[10]:=')';
  34.      letter[11]:='1';
  35.      letter[12]:='2';
  36.      letter[13]:='3';
  37.      letter[14]:='4';
  38.      letter[15]:='5';
  39.      letter[16]:='6';
  40.      letter[17]:='7';
  41.      letter[18]:='8';
  42.      letter[19]:='9';
  43.      letter[20]:='0';
  44.  
  45.      Clrscr;
  46.      Initialize;      { Note that you must initialize the random numbers }
  47.      Writeln('TYPETEST - by Ray Sun');
  48.      Writeln('The program will not continue until the correct key is typed.');
  49.      Writeln('Type the key to continue, ESC to abort program.');
  50.      Writeln;
  51.      For loop := 1 to 10 do
  52.      begin
  53.           Answer := ' ';
  54.           num := RandomNumber (questions);   { RAND.TPU in action! }
  55.           writeln(letter[num]);
  56.           While answer <> letter[num] do
  57.           begin
  58.                     answer:=readkey;
  59.                     If answer=#27 then halt;
  60.           end;
  61.      end;
  62. END.
  63.